package com.samphanie.dries.repository;

import com.samphanie.dries.domain.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.Optional;

/**
 * @Description:
 * @Author ZSY
 * @createTime 2021/2/26 10:57
 */
@Repository
public interface UserRepo extends JpaRepository<User, Long> {

    Optional<User> findOptionalByUsername(String username);

    long countByUsername(String username);
    long countByEmail(String email);
    long countByEmailAndUsernameIsNot(String email, String username);
    long countByMobile(String mobile);
    long countByMobileAndUsernameIsNot(String mobile, String username);

}
